package cn.bass.marketing.controller;


import cn.bass.marketing.common.annotations.AppLog;
import cn.bass.marketing.convertor.MarketingActivityConvertor;
import cn.bass.marketing.entity.MarketingActivityDO;
import cn.bass.marketing.common.resp.Response;
import cn.bass.marketing.service.activity.MarketingActivityService;
import cn.bass.marketing.common.vo.req.MarketingActivityReqVO;
import cn.bass.marketing.common.vo.resp.MarketingActivityRespVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author Fuzhengwei bugstack.cn @小傅哥
 * @description 抽奖活动服务 注意；在不引用 application/case 层的时候，就需要让接口实现层来做领域的串联。一些较大规模的系统，需要加入 case 层。
 * @create 2024-04-13 09:42
 */
@Slf4j
@RestController
@CrossOrigin("${app.config.cross-origin}")
@RequestMapping("/api/${app.config.api-version}/activity/")
public class MarketingActivityController {

    @Resource
    private MarketingActivityService marketingActivityService;


    @PostMapping("/list")
    @AppLog(value = "获取活动列表")
    public Response<List<MarketingActivityRespVO>> activityList(@RequestBody MarketingActivityReqVO marketingActivityVO) {
        List<MarketingActivityDO> activityList = marketingActivityService.getActivityList(marketingActivityVO);
        return Response.success(MarketingActivityConvertor.INSTANCE.dto2respVO(activityList));
    }

}
